package cc.autoapi.pucong.auto.flow.core.qlexpress.enumSelf;

public enum OperationTypeEnum {
    GT("gt", "大于"),
    LT("lt", "小于"),
    GE("ge", "大于等于"),
    LE("le", "小于等于"),
    EQ("eq", "等于"),
    EQ_NOT_CASE("eqNotCase", "等于(不分大小写)"),
    NE("ne", "不等于"),
    NE_NOT_CASE("neNotCase", "不等于(不分大小写)"),
    START_WITH("startWith", "以xx开始"),
    NOT_START_WITH("notStartWith", "不以xx开始"),
    END_WITH("endWith", "以xx结束"),
    NOT_END_WITH("notEndWith", "不以xx结束"),
    IN_LIST("inList", "在集合"),
    NOT_IN_LIST("notInList", "不在集合"),
    IS_NULL("isNull", "为空"),
    NOT_NULL("notNull", "不为空"),
    IS_REGEX("isRegex", "匹配正则表达式"),
    NOT_REGEX("notRegex", "不匹配正则表达式"),
    CONTAIN("contain", "字符串包含"),
    NOT_CONTAIN("notContain", "字符串不包含"),

    ;

    private String code;
    private String desc;

    private OperationTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static OperationTypeEnum getEnumByCode(String code) {
        for (OperationTypeEnum e : OperationTypeEnum.values()) {
            if (e.getCode().equals(code)) {
                return e;
            }
        }
        return null;
    }

    public String getCode() {
        return code;
    }
}
